home *** CD-ROM | disk | FTP | other *** search
/ The PC-SIG Library 10 / The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso / PC_SIGCD / 05 / 6 / DISK0564.ZIP / SOURCE.ARC / B.ARC / CPYCNT.C < prev    next >
Text File  |  1986-03-17  |  503b  |  14 lines

  1. char *cpycnt(source,dest,n)
  2. register char *source,*dest; int *n;
  3. /* copies from source to dest until null copied, or at most n chars. copied.
  4.    if null not found in source, appends a null to dest at end.  sets n to
  5.    the number of chars short of the limit in dest (0 if dest full).
  6.    also returns pointer to null in dest. */
  7. /* n.b. this is different from Manx's strncpy function. */
  8. {
  9.     while ((*source) && (*n)--)
  10.         *dest++ = *source++;
  11.     *dest = '\000';
  12.     return(dest);
  13. }
  14.